﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPages/Core.Master"
    CodeBehind="AssociationDues.aspx.cs" Inherits="Pap.Web.Modules.Loan.Views.AssociationDues"
    meta:resourcekey="PageResource1" %>

<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <ext:Store runat="server" ID="storeLoans" AutoLoad="True" IDMode="Static" meta:resourcekey="storeLoansResource1"
        SerializationMode="Simple">
        <Reader>
            <ext:JsonReader ReaderID="LoanExecutionInstallmentID">
                <Fields>
                    <ext:RecordField Name="LoanExecutionInstallmentID">
                    </ext:RecordField>
                    <ext:RecordField Name="LoanNumber" />
                    <ext:RecordField Name="CustomerName" />
                    <ext:RecordField Name="InstallmentDate" Type="Date" />
                    <ext:RecordField Name="OriginalInstallmentAmount" />
                    <ext:RecordField Name="InterestInstallmentAmount" />
                    <ext:RecordField Name="PenaltyAmount" />
                    <ext:RecordField Name="TodayDues" />
                    <ext:RecordField Name="Total" />
                    <ext:RecordField Name="PenaltyDays" />
                    <ext:RecordField Name="LoanID" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:FitLayout ID="uxContainer" runat="server" meta:resourcekey="FitLayoutResource1">
        <ext:Panel runat="server" Icon="Money" AutoScroll="True" meta:resourcekey="PanelResource2">
            <TopBar>
                <ext:Toolbar runat="server">
                    <Items>
                        <ext:Button ID="uxAllDues" runat="server" Icon="FlagGrey" ToggleGroup="Dues" Text="<%$Resources:All %>">
                            <ToolTips>
                                <ext:ToolTip ID="ToolTip1" runat="server" Title="<%$Resources:All %>" />
                            </ToolTips>
                            <Listeners>
                                <Click Handler="Ext.getCmp('#{uxDatesToolbar}').hide();" />
                            </Listeners>
                            <AjaxEvents>
                                <Click OnEvent="btnAllDues_Click">
                                    <EventMask Msg="Loading..." ShowMask="true" Target="CustomTarget" CustomTarget="#{uxGrid}" />
                                </Click>
                            </AjaxEvents>
                        </ext:Button>
                        <ext:Button runat="server" Icon="FlagRed" ToggleGroup="Dues" Text="<%$Resources:LateDues %>">
                            <ToolTips>
                                <ext:ToolTip runat="server" Title="<%$Resources:LateDues %>" />
                            </ToolTips>
                            <Listeners>
                                <Click Handler="Ext.getCmp('#{uxDatesToolbar}').hide();" />
                            </Listeners>
                            <AjaxEvents>
                                <Click OnEvent="BtnLateDues_Click">
                                    <EventMask Msg="Loading..." ShowMask="true" Target="CustomTarget" CustomTarget="#{uxGrid}" />
                                </Click>
                            </AjaxEvents>
                        </ext:Button>
                        <ext:Button runat="server" Icon="FlagBlue" ToggleGroup="Dues" Text="<%$Resources:Today'sDues %>">
                            <ToolTips>
                                <ext:ToolTip runat="server" Title="<%$Resources:Today'sDues %>" />
                            </ToolTips>
                            <Listeners>
                                <Click Handler="Ext.getCmp('#{uxDatesToolbar}').hide();" />
                            </Listeners>
                            <AjaxEvents>
                                <Click OnEvent="BtnTodayDues_Click">
                                    <EventMask Msg="Loading..." ShowMask="true" Target="CustomTarget" CustomTarget="#{uxGrid}" />
                                </Click>
                            </AjaxEvents>
                        </ext:Button>
                        <ext:Button runat="server" Icon="FlagWhite" ToggleGroup="Dues" Text="<%$Resources:FromToPeriod %>">
                            <ToolTips>
                                <ext:ToolTip runat="server" Title="<%$Resources:FromToPeriod %>" />
                            </ToolTips>
                            <Listeners>
                                <Click Handler="Ext.getCmp('#{uxDatesToolbar}').show();" />
                            </Listeners>
                        </ext:Button>
                        <ext:ToolbarSeparator runat="server" />
                        <ext:Toolbar runat="server" Flat="true" ID="uxDatesToolbar" Hidden="true">
                            <Items>
                                <ext:DateField runat="server" ID="DuesFromDate" Format="dd-MM-yyyy" IDMode="Static"
                                    EmptyText="<%$ Resources:DateFrom%>" Width="151px" AllowBlank="true" meta:resourcekey="DateFrom">
                                </ext:DateField>
                                <ext:DateField runat="server" ID="DuesToDate" Format="dd-MM-yyyy" IDMode="Static"
                                    EmptyText="<%$ Resources:DateTo%>" Width="151px" AllowBlank="true" meta:resourcekey="DateTo">
                                </ext:DateField>
                                <ext:Button runat="server" Icon="ApplicationGo">
                                    <AjaxEvents>
                                        <Click OnEvent="BtnDuesForInterval_Click">
                                            <EventMask Msg="Loading..." ShowMask="true" Target="CustomTarget" CustomTarget="#{uxGrid}" />
                                        </Click>
                                    </AjaxEvents>
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </Items>
                </ext:Toolbar>
            </TopBar>
            <Body>
                <ext:FitLayout runat="server">
                    <ext:GridPanel ID="uxGrid" runat="server" StoreID="storeLoans" meta:resourcekey="GridPanelResource1"
                        AutoExpandColumn="CustomerName">
                        <ColumnModel>
                            <Columns>
                                <ext:ImageCommandColumn Header="<%$Resources:PayHeader %>" Hideable="False" Sortable="True"
                                    Width="70px" Align="Center">
                                    <Commands>
                                        <ext:ImageCommand Icon="MoneyAdd" CommandName="PayInstallment">
                                        </ext:ImageCommand>
                                    </Commands>
                                </ext:ImageCommandColumn>
                                <ext:Column DataIndex="LoanNumber" Width="50" Header="<%$Resources:LoanNumberHeader %>"
                                    Sortable="True" />
                                <ext:Column DataIndex="CustomerName" Header="<%$Resources:CustomerNameHeader %>"
                                    Sortable="True" />
                                <ext:Column DataIndex="InstallmentDate" Header="Installment Date" Sortable="true">
                                    <Renderer Fn="Ext.util.Format.dateRenderer('d/m/Y')" />
                                </ext:Column>
                                <ext:Column DataIndex="OriginalInstallmentAmount" Header="<%$Resources:OriginalDelaysAmountHeader %>"
                                    Sortable="True" />
                                <ext:Column DataIndex="InterestInstallmentAmount" Header="<%$Resources:InterestDelaysAmountHeader %>"
                                    Sortable="True" />
                                <ext:Column DataIndex="PenaltyAmount" Header="<%$Resources:PenaltyAmountHeader %>"
                                    Sortable="True" />
                                <ext:Column DataIndex="TodayDues" Header="<%$Resources:TodayDueAmountHeader %>" Sortable="True" />
                                <ext:Column DataIndex="Total" Header="<%$Resources:TotalAmountHeader %>" Sortable="True" />
                                <ext:Column DataIndex="PenaltyDays" Header="<%$Resources:DelaysDaysHeader %>" Sortable="True" />
                            </Columns>
                        </ColumnModel>
                        <AjaxEvents>
                            <Command OnEvent="GrvDueLoans_Command">
                                <EventMask />
                                <ExtraParams>
                                    <ext:Parameter Name="CommandName" Value="command" Mode="Raw" Encode="False" />
                                    <ext:Parameter Name="LoanExecutionInstallmentID" Value="record.data.LoanExecutionInstallmentID"
                                        Mode="Raw" Encode="False" />
                                </ExtraParams>
                            </Command>
                        </AjaxEvents>
                        <SelectionModel>
                            <ext:RowSelectionModel runat="server">
                            </ext:RowSelectionModel>
                        </SelectionModel>
                        <BottomBar>
                            <ext:PagingToolbar ID="pagingBar" runat="server" StoreID="storeLoans" PageSize="25"
                                DisplayInfo="True" IDMode="Static" meta:resourcekey="pagingBarResource1">
                            </ext:PagingToolbar>
                        </BottomBar>
                    </ext:GridPanel>
                </ext:FitLayout>
            </Body>
            <BottomBar>
                <ext:StatusBar runat="server" ID="statusBar">
                    <Items>
                        <ext:Button runat="server" ID="btnBack" Icon="ArrowUndo" meta:resourcekey="btnBackResource">
                            <AjaxEvents>
                                <Click OnEvent="BtnBack_Clicked" ViewStateMode="Include" />
                            </AjaxEvents>
                        </ext:Button>
                    </Items>
                </ext:StatusBar>
            </BottomBar>
        </ext:Panel>
    </ext:FitLayout>
</asp:Content>
